package com.azt.api.dto;

import com.azt.utils.MyStringUtils;
import com.xiaoleilu.hutool.date.BetweenFormater;
import com.xiaoleilu.hutool.date.DateUtil;

import java.io.Serializable;
import java.util.Date;

/**
 * 首页最新询价单DTO
 * Created by shangwq on 2017/1/4.
 */
public class IndexEnquiry implements Serializable {

    private Integer enquiryId;

    private Integer qtype;

    private String enquiryName;

    /**
     * 项目所在地（省份）
     * */
    private String provinceName;

    private String companyName;

    private Date deadline;

    private Integer productNum;

    private Integer quoteNum;

    private Integer viewNum;

    public Integer getEnquiryId() {
        return enquiryId;
    }

    public void setEnquiryId(Integer enquiryId) {
        this.enquiryId = enquiryId;
    }

    public Integer getQtype() {
        return qtype;
    }

    public void setQtype(Integer qtype) {
        this.qtype = qtype;
    }

    public String getEnquiryName() {
        return enquiryName;
    }

    public void setEnquiryName(String enquiryName) {
        this.enquiryName = enquiryName;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public Date getDeadline() {
        return deadline;
    }

    public void setDeadline(Date deadline) {
        this.deadline = deadline;
    }

    public Integer getProductNum() {
        return productNum;
    }

    public void setProductNum(Integer productNum) {
        this.productNum = productNum;
    }

    public Integer getQuoteNum() {
        return quoteNum;
    }

    public void setQuoteNum(Integer quoteNum) {
        this.quoteNum = quoteNum;
    }

    public Integer getViewNum() {
        return viewNum;
    }

    public void setViewNum(Integer viewNum) {
        this.viewNum = viewNum;
    }

    public String getHiddenCompanyName() {
//        return CommonUtil.getHiddenStr(this.companyName, 4);
        return MyStringUtils.hideCompanyName(this.companyName);
    }

    public String getDeadlineStr() {
        if(this.deadline != null && DateUtil.offsetDay(this.deadline, 1).after(new Date())) {
            return DateUtil.formatBetween(new Date(), DateUtil.offsetDay(this.deadline, 1), BetweenFormater.Level.MINUTE);
        }
        return null;
    }

}
